<template>
  <!--    <el-input :model="value1" placeholder="请输入需要生成的内容" clearable @input="aaa" />-->

  <div v-if="printOpen" class="app-container">

    <div id="printMe" class="print-box">

      <div class="print-header">
        <div class="left">南京新闻奖申报</div>
        <div class="right">江苏新华社分社</div>
      </div>

      <div class="ins-form">
        <div class="ins-form-row">
          <div class="ins-form-label">作品标题：</div>
          <div class="ins-form-input">{{ form.news_title }}</div>
        </div>
        <div class="ins-form-row">
          <div class="ins-form-label">作品链接：</div>
          <div class="ins-form-input">{{ form.news_link }}</div>
        </div>

        <div v-for="(item, index) in form.publication_json" :key="index" class="ins-form-row">
          <div class="ins-form-label">刊指平台（{{ index + 1 }}）：</div>
          <div class="ins-form-input">{{ item.publication_platform }}</div>
          <div class="ins-form-label">刊指日期：</div>
          <div class="ins-form-input">{{ item.publication_date }}</div>
          <div class="ins-form-label">刊指版面：</div>
          <div class="ins-form-input">{{ item.publication_layout }}</div>
        </div>

        <div class="ins-form-row">
          <div class="ins-form-label">作者姓名：</div>
          <div class="ins-form-input">{{ form.author_name }}</div>
          <div class="ins-form-label">编者：</div>
          <div class="ins-form-input">{{ form.editor }}</div>
        </div>

        <div class="ins-form-row">
          <div class="ins-form-label">署名排序：</div>
          <div class="ins-form-input">{{ form.byline_order }}</div>
        </div>

        <div class="ins-form-row">
          <div class="ins-form-label">作品简介：</div>
          <div class="ins-form-input">
            {{ form.work_summary }}</div>
        </div>

        <div style="margin-top: 150px;" />

        <div class="ins-form-row ins-form-footer">
          <div class="ins-form-footer-item">
            <div class="ins-form-footer-label">填报人：</div>
            <div class="ins-form-footer-value">{{ form.reporter }}</div>
          </div>
        </div>
        <div class="ins-form-row ins-form-footer">
          <div class="ins-form-footer-item">
            <div class="ins-form-footer-label">手机号：</div>
            <div class="ins-form-footer-value">{{ form.reporter_phone }}</div>
          </div>
        </div>

      </div>

    </div>

    <el-row style="text-align:center;">
      <el-col :span="24">
        <el-button v-print="'#printMe'" icon="el-icon-printer" type="primary" style="padding: 5px 15px !important;">打印</el-button>
      </el-col>
    </el-row>

  </div>

</template>
<script>
import { warehousingPrint } from '@/api/storehouse'
import JsBarcode from 'jsbarcode'
export default {
  name: 'InstitutionPrint',
  components: {
  },
  props: {
    printOpen: {
      type: Boolean
    },
    form: {
      type: Object
    }
  },
  data() {
    return {
      value1: '',
      list: []
    }
  },
  watch: {
    'openOne': function(newValue, oldValue) {
      if (newValue === true) {
        this.printList()
      }
    }
  },
  created() {

  },
  methods: {
    printList() {
      const that = this
      const data = {
        warehousing_id: this.warehousing_id,
        warehousing_son_id: this.warehousing_son_id
      }
      warehousingPrint(data).then(response => {
        if (response.code === 10000) {
          that.list = response.data
        }
      })
    },
    close() {
      this.$emit('update:openOne', false)
    }
  }
}
</script>
<style lang="scss" scoped>
.print-box{
  .print-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left{
      font-size: 20px;
    }
    .right{
      font-size: 16px;
    }
    margin-bottom: 50px;
  }
  .ins-form {
    font-size: 14px;
    line-height: 1.5;
  }

  .ins-form-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
  }

  .ins-form-label {
    flex: 0 0 150px;
    text-align: right;
    margin-right: 10px;
  }

  .ins-form-input {
    flex: 1;
    border-bottom: 1px solid #000;
    padding: 2px 5px;
  }

  .ins-form-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
  }

  .ins-form-footer-item {
    display: flex;
    align-items: center;
    margin-left: 20px;
  }

  .ins-form-footer-label {
    font-weight: bold;
    margin-right: 5px;
  }

  .ins-form-footer-value {
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
    width: 200px;
  }
}

</style>

